<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8" />
	<meta content='True' name='HandheldFriendly' />
	<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
	<title>{% if topic %}{{ site.title }} › {{ topic.title|escape }}{% else %}{{ site.title }} › 主题未找到{% endif %}</title>
	<link rel="stylesheet" type="text/css" media="screen"  href="/static/css/mobile/style.css?v={{ system_version }}" />
	<link rel="shortcut icon" href="/favicon.ico" />
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
</head>
<body>
	{% include 'common/top.html' %}
    <div id="Main">
        <div class="section"><a href="/" class="black">{{ site.title }}</a> › <a href="/go/{{ node.name }}" class="black">{{ node.title }}</a></div>
        <div class="cell">
            <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr>
    			<td valign="top" class="avatar"><a href="/member/{{ topic.created_by }}">{{ topic.member|avatar:"normal" }}</a></td>
    			<td style="padding-left: 5px" valign="top">
    			    <div class="fr"><span class="snow">{% if member %}{% ifequal member.level 0 %}<a href="/edit/topic/{{ topic.num }}">EDIT</a> | <a href="#;" onclick="if (confirm('{{ l10n.sure_to_delete }} #{{ topic.num }} - {{ topic.title|escape }}')) { location = '/delete/topic/{{ topic.num }}'; }">DEL</a>{% endifequal %}{% endif %}</span></div>
    			    <h1>{{ topic.title|escape }}</h1>
    			    <div class="sep5"></div>
                    <span class="fade">By <a href="/member/{{ topic.created_by }}">{{ topic.created_by }}</a>{% if topic.source %} <span class="fade">via {{ topic.source }}</span>{% endif %} at {{ topic.created|timesince }} ago - {{ topic.hits }} views</span>
                    <div class="sep10"></div>
                    {{ topic.content|escape|imgly|mentions|autolink|linebreaksbr }}
    			</td>
    			</tr>
    		</table>
        </div>
		<div class="cell"><div class="fr">{% if topic.stars %}<strong class="fade">已有 {{ topic.stars }} 人收藏 &nbsp; </strong>{% endif %}{% if favorited %}<a href="/unfavorite/topic/{{ topic.num }}?t={{ member.username_lower_md5 }}" class="op">取消收藏</a>{% else %}<a href="/favorite/topic/{{ topic.num }}?t={{ member.username_lower_md5 }}" class="op">加入收藏</a>{% endif %}
		</div>
        <strong class="fade">共收到 {{ topic.replies }} 条回复</strong>
        </div>
        <script type="text/javascript">
            is_admin = {{ is_admin }};
            replies_keys = new Array(); replies_ids = new Array(); replies_parents = new Array();
        </script>
        <div id="replies">
        {{ r }}
        </div>
        {% if member %}
        <script type="text/javascript">
        blocked = [{{ blocked }}];
        $("#replies").children('.cell').each( function(index) {
            for (i in blocked) {
                if ($(this).hasClass('from_' + blocked[i])) {
                    $(this).css('display', 'none');
                }
            }
            if (is_admin) {
                $(this).find("span.ops").html(' &nbsp; <a href="/backstage/tidy/reply/' + replies_ids[index] + '">TIDY</a> &nbsp; <a href="/edit/reply/' + replies_ids[index] + '">EDIT</a> &nbsp; <a href="#;" onclick="if (confirm(\'确认删除此回复？\')) { location.href = \'/backstage/remove/reply/' + replies_keys[index] + '?t={{ member.created_ts }}\'; }">DEL</a> &nbsp;<img src="/static/img/' + (replies_parents[index] ? 'dot_green.png' : 'dot_red.png') + '" align="absmiddle" />');
            }
        });
        </script>
        {% endif %}
        {% if member %}
        <div class="cell">
        {% if errors %}
        <strong class="black">{{ reply_content_error_message }}</strong>
        {% else %}
        <span class="fade">现在就加盖一层</span>{% endif %}<form action="/t/{{ topic.num }}" method="post">
        <div class="sep5"></div>
        <textarea name="content" class="mll">{{ reply_content|escape }}</textarea>
        <div class="sep5"></div><div class="fr" style="font-size: 12px; margin-top: 5px; margin-right: 5px;"><a href="/">← {{ site.title }}</a></div>
        <input type="submit" value="Reply" />
        </textarea></form>
        </div>
        {% else %}
        <div class="cell">
        希望参与讨论？请先 <a href="/signin">登入</a> 或 <a href="/signup">注册</a>
        </div>
        {% endif %}
	</div>
	{% include 'common/bottom.html' %}
	{% include 'ads/running.html' %}
</body>
</html>
